<?php
/*
Template Name: news;
*/
?>

<?php get_header(); ?>
<?php include (TEMPLATEPATH . "/navigation.php")?>
<?php include (TEMPLATEPATH . "/middle_menu.php")?>

<?php include (TEMPLATEPATH . "/myfunction.php");


// retreives image from the post

?>

  <div id="contentinside">
    <div id="insidepageheader">
      <div class="padding-top15 padding-left25"><img src="<?php bloginfo('template_url'); ?>/img/inside_page/h1_news.gif" alt="News&amp;Event" /></div>
    </div>
<div id="insidepagecontent">
          
      <div class="insidepagemaincontent margin-top20">

     <?php 
     
     
    $post_total = count( $ps = get_posts("category=1&post_status=publish&post_type=post"));

	$page_limit =10;
		
	$page_offset = 0;
		
	$page_current = 1;
		
	$page_total  =  ceil($post_total/$page_limit);
		
	if(isset($_GET['page']))	
	{
	
	        $page_current = $_GET['page'];
			if($page_current>1){	
	        $page_offset   =  (($page_current-1) * $page_limit) ;
			}
		
	}

	
     

     
     $ps = get_posts("offset=".$page_offset."&numberposts=".$page_limit."&category=1&post_status=publish&post_type=post");
		//print_r($ps);
	 global $post;
     foreach($ps as $post):
	 setup_postdata($post);
	 if(getImage('1'))
	 {
	 	$image = getImage('1');
	 }else
	 {
	 	$image =  get_option('siteurl')."/wp-content/themes/fusion/img/default.jpg";
	 }
     ?>

      <!-- Class loop start -->   
      <div class="margin-bottom10">
      <div style="border-bottom: #999999 1px dotted; float: left;" class="padding-bottom15">
      <div class="classphoto"><a>
      <img style="width:150px; height:130px;"  src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $image; ?>&w=250&h=250&zc=1" alt="" /></a></div>
      <div class="left classtext">
      <div class="bold margin-bottom5"><a href="<?php the_permalink(); ?>"><?php the_date(); ?>  <?php the_title(); ?></a></div>
             <?php echo  the_excerpt();?> </div>
<div class="clear"></div>
</div>
<div class="right margin-top15"><a href="<?php the_permalink(); ?>" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','<?php bloginfo('template_url'); ?>/img/inside_page/readmore_on.jpg',1)"><img src="<?php bloginfo('template_url'); ?>/img/inside_page/readmore.jpg" alt="Read more" name="Image16" width="94" height="30" border="0" id="Image16" /></a></div>
      <div class="clear"></div>
      </div>
     
     
      <!-- Class loop end --> 
     <?php endforeach; ?>
     
     	 <?php if($page_current > 1){?>
      <div id="paging">
      <?php for($i=0;$i<$page_total;$i++):
			if($page_current ==($i+1)){
      	?>
			<a href="<?php echo bloginfo("siteurl"); ?>/event/?page=<?php echo ($i+1); ?>" class="active"><?php echo ($i+1); ?></a> 
		<?php }else{ ?>
				<a href="<?php echo bloginfo("siteurl"); ?>/event/?page=<?php echo ($i+1); ?>" ><?php echo ($i+1); ?></a> 
      	<?php }
			endfor;
      	?>
      	</div>
      	<?php } ?>
      </div>
    </div>
  </div>
  <div class="clear"> </div>
  <div id="insidepagebottom"> </div>
  <div class="clear"> </div>
<?php get_footer(); ?>